﻿ // UnderlineStyle.cs
//
// Author: Luoyingliang
// Email: 731984870@qq.com
// 
// Copyright (c) 2018 Team Acoris
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

using System;
using System.Collections.Generic;
using System.Text;

namespace Acoris.Rendering
{
    //using static Acoris.Utils.ValueRangeChecker;
    //using System.Numerics;

    ///// <summary>
    ///// represents a underline style
    ///// </summary>
    //public sealed class UnderlineStyle:IEqualityComparer<UnderlineStyle>,IEquatable<UnderlineStyle>
    //{
    //    /// <summary>
    //    /// gets the break line
    //    /// </summary>
    //    public static readonly UnderlineStyle BreaklineStyle = new UnderlineStyle
    //    {
    //        Increament = 4,
    //        GeometrySegments = new Vector2[]
    //        {
    //            new Vector2(0,-2),
    //            new Vector2(2,0),
    //            new Vector2(4,-2)

    //        }
    //    };

    //    private UnderlineStyle() { }

    //    public UnderlineStyle(Vector2[] geometrySegments) {
    //        CheckArrayRange(geometrySegments);
    //        this.GeometrySegments = geometrySegments;
    //    }

    //    public static void ValidateUnderlineStyle(UnderlineStyle style) {
    //        CheckArrayRange(style.GeometrySegments);
    //        CheckZeroRange(style.Increament);
    //    }

    //    /// <summary>
    //    /// gets or sets GeometrySegments
    //    /// </summary>
    //    public Vector2[] GeometrySegments { get; set; }

    //    /// <summary>
    //    /// gets or sets the underline atomic element increament
    //    /// </summary>
    //    public float Increament { get; set; }

    //    /// <summary>
    //    /// gets or sets the underline brush
    //    /// </summary>
    //    public GraphicBrush Brush { get; set; }

    //    /// <summary>
    //    /// 
    //    /// </summary>
    //    /// <param name="x"></param>
    //    /// <param name="y"></param>
    //    /// <returns></returns>
    //    public bool Equals(UnderlineStyle x, UnderlineStyle y) {
    //        var result = x.GeometrySegments.Length == y.GeometrySegments.Length;
    //        if (!result) {
    //            return result;
    //        }


    //        for (int i = 0; i < x.GeometrySegments.Length; i++) {
    //            if (x.GeometrySegments[i] != y.GeometrySegments[i]) {
    //                return false;
    //            }
    //        }
    //        return x.Increament == y.Increament && result;
    //    }

    //    /// <summary>
    //    /// 
    //    /// </summary>
    //    /// <param name="other"></param>
    //    /// <returns></returns>
    //    public bool Equals(UnderlineStyle other) {
    //        var x = this;
    //        var y = other;

    //        var result = x.GeometrySegments.Length == y.GeometrySegments.Length;
    //        if (!result) {
    //            return result;
    //        }


    //        for(int i = 0; i < x.GeometrySegments.Length; i++) {
    //            if(x.GeometrySegments[i] != y.GeometrySegments[i]) {
    //                return false;
    //            }
    //        }
    //        return x.Increament == y.Increament && result;
    //    }

    //    /// <summary>
    //    /// 
    //    /// </summary>
    //    /// <param name="obj"></param>
    //    /// <returns></returns>
    //    public int GetHashCode(UnderlineStyle obj) {
    //        return obj.GetHashCode();
    //    }

    //    /// <summary>
    //    /// 
    //    /// </summary>
    //    /// <param name="obj"></param>
    //    /// <returns></returns>
    //    public override bool Equals(object obj) {

    //        if(obj is UnderlineStyle us) {

    //            var result = us.GeometrySegments.Length == this.GeometrySegments.Length;
    //            if (!result) {
    //                return result;
    //            }

    //            for (int i = 0; i < GeometrySegments.Length; i++) {
    //                if(this.GeometrySegments[i] != us.GeometrySegments[i]) {
    //                    return false;
    //                }
    //            }
    //            return us.Increament == this.Increament && result;
    //        }
    //        return base.Equals(obj);
    //    }

    //    /// <summary>
    //    /// 
    //    /// </summary>
    //    /// <returns></returns>
    //    public override int GetHashCode() {
    //        return (base.GetHashCode() ^ GeometrySegments.GetHashCode()) + (int)Increament;
    //    }

    //    /// <summary>
    //    /// 
    //    /// </summary>
    //    /// <returns></returns>
    //    public override string ToString() {
    //        return $"increment:{Increament},array:{GeometrySegments.Length}";
    //    }        
    //}
}
